<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<script type="text/javascript">



function init_table_sorting()
{
	initCityList();
	//Only init if there is more than one row
	if($('.tablesorter tbody tr').length >1)
	{
		$("#sortable_table").tablesorter(
		{

			sortList: [[1,0]],
			headers:
			{
				0: { sorter: false},
				5: { sorter: false}
			}

		});
	}
}


  $(document).ready(function()
{

       init_table_sorting();
        enable_select_all();
        enable_checkboxes();
        enable_row_selection();
        enable_search('<s:url action="suggest"/>','You have selected one or more rows, these will no longer be selected after your search. Are you sure you want to submit this search?');

     $("#filter_customer_button").click(function()
              {

           newSearch();
	     });

	function newSearch(){


        var options = {
                            target:     '#sortable_table tbody',
                            success:    function() {
                                  $('#spinner').hide();
        	                      tb_init('#sortable_table a.thickbox');

                            },
                            beforeSubmit: function(){
        	                     $('#spinner').show();

                            }
                        };

            	        $('#filter_customer_form').ajaxSubmit(options);



	    }



     $('#filter_customer_form').submit(function(event)
	{
		event.preventDefault();


		  newSearch();
	});

    } );
	</script>

<form action="<s:url action="search"/>" method="post" accept-charset="utf-8" id="filter_customer_form">

<div class='form_field'>
	City:<input type="text" id="city" name="city" value="${city}" id="name"  />
	    <input type="button" name="filter" id="filter_customer_button" value="filter"/>
       <img id="spinner" alt="spinner" src="${pageContext.request.contextPath}/images/spinner_small.gif"/>
	</div>


</div>
</form>
<table id="title_bar">
	<tbody><tr>
		<td id="title_icon">
			<img alt="title icon" src="${pageContext.request.contextPath}/images/menubar/customers.png">
		</td>
		<td id="title">
			List of Customers		</td>
		<td id="title_search">
			<form id="search_form" accept-charset="utf-8" method="post" action="<s:url action="search"/>">
			<input type="text" id="search" name="search"  class="ui-autocomplete-input" autocomplete="off" role="textbox" aria-autocomplete="list" aria-haspopup="true">
				<img id="spinner" alt="spinner" src="${pageContext.request.contextPath}/images/spinner_small.gif">
			</form>
		</td>
		<td id="commands">
			<div id="new_button">
				<a title="New Customer" class="thickbox none new" href="<s:url action="new"/>">New Customer</a>
		</td>
	</tr>
</tbody>
</table>


			<jsp:include page="list.jsp" />

			</div>
			<div id="pagination">
		</div>
		</td>
	</tr>
</tbody></table>
<div id="feedback_bar"></div>
